package com.agileplex.codeminer.scm.svn;

import java.util.ArrayList;
import java.util.List;

import com.agileplex.codeminer.scm.IDirectory;

/**
 * Directory in Subversion repository
 * 
 * @creator Weiming Yin
 * @date 2007-6-6
 *
 * @lastmodified
 * @author $Author: yinweiming $
 * @version $Revision: 14 $, $Date: 2007-06-11 15:37:58 +0000 (Mon, 11 Jun 2007) $
 */
public class SvnDirectory implements IDirectory {
	
	private SvnVersion v;
	private String name;
	
	private List<SvnDirectory> dirs;
	private List<SvnFile> files;
	
	public SvnDirectory(SvnVersion v, String name) {
		this.v = v;
		this.name = name;
		
		this.dirs = new ArrayList<SvnDirectory>();
		this.files = new ArrayList<SvnFile>();
	}

	public String getName() {
		return name;
	}

	public SvnVersion getVersion() {
		return v; 
	}

	public void addDir(SvnDirectory dir) {
		this.dirs.add(dir);
	}
	
	public void setDirs(List<SvnDirectory> dirs) {
		this.dirs = new ArrayList<SvnDirectory>(dirs);
	}
	
	public List<SvnDirectory> listDirs() {
		return new ArrayList<SvnDirectory>(dirs);
	}

    public void addFile(SvnFile f) {
        this.files.add(f);
    }
    
    public void setFiles(List<SvnFile> l) {
        this.files = new ArrayList<SvnFile>(l);
    }
    
	public List<SvnFile> listFiles() {
		return new ArrayList<SvnFile>(files);
	}
	
	public String toString() {
		return "[" + v + "] " + name;
	}

}
